//
//  DBData.h
//  exhibition
//
//  Created by thomas on 13-9-3.
//  Copyright (c) 2013年 thomas. All rights reserved.
//
#import <Foundation/Foundation.h>
#define dbName @"data.db"

#define tb_beacon @"beacon"
#define tb_relic @"relic"
#define tb_spot @"spot"
#define tb_region @"region"

#define docPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define docDataPath [docPath stringByAppendingPathComponent:@"Data"]

@interface DBData : NSObject
+ (void)resetdatabase;
+ (BOOL)ImportTb:(NSString*)tbName data:(NSArray*)array key:(NSString*)key;
+ (BOOL)ImportTb:(NSString*)tbName file:(NSString*)path key:(NSString*)key;

+ (BOOL)InsertReplace:(NSString*)tbName values:(NSDictionary*)dict;
+ (BOOL)Update:(NSString*)tbName values:(NSDictionary*)dict condition:(NSString*)con;
+ (NSArray*)Select:(NSString*)tbName Filelds:(NSArray*)array condition:(NSString*)con;
+ (BOOL)Delete:(NSString*)tbName condition:(NSString*)con;

+ (void)excuteFile:(NSString*)path;

+ (void)ImportSyncTb:(NSString*)tbName file:(NSString*)path key:(NSString*)key;

+ (NSArray*)excuteSelect:(NSString*)sql Filelds:(NSArray*)array;


+ (BOOL)InsertReplaceDB:(NSString*)db table:(NSString*)tbName values:(NSDictionary*)dict;
+ (BOOL)UpdateDB:(NSString*)db table:(NSString*)tbName values:(NSDictionary*)dict condition:(NSString*)con;
+ (NSArray*)SelectDB:(NSString*)db table:(NSString*)tbName Filelds:(NSArray*)array condition:(NSString*)con;
+ (BOOL)DeleteDB:(NSString*)db table:(NSString*)tbName condition:(NSString*)con;
+ (BOOL)ImportDB:(NSString*)db table:(NSString*)tbName data:(NSArray*)array key:(NSString*)key;
@end
